﻿@model ConfigurationModel

@{    
    Layout = "_ConfigureProvider";
}

@await Component.InvokeAsync("StoreScope")

<widget target-zone="admin_button_toolbar_before">
    <button id="SaveConfigButton" type="submit" name="save" class="btn btn-warning" value="save">
        <i class="fa fa-check"></i>
        <span>@T("Admin.Common.Save")</span>
    </button>
</widget>

<div class="plugin-configuration">
    <div>
        <div class="alert alert-info alert-dismissible">
            @Html.Raw(T("Plugins.Smartstore.Stripe.AdminInstruction"))
            <button type="button" class="btn-close" data-dismiss="alert"></button>
        </div>
    </div>
    <div>
        <a href="#" target="_blank">
            <img src="@Url.Content("~/Modules/Smartstore.Stripe/branding.png")" alt="Stripe" />
        </a>
    </div>
</div>

<form asp-action="Configure">
    <div asp-validation-summary="All"></div>
    <div class="adminContent">
        <div class="adminRow">
            <div class="adminTitle">
                <smart-label asp-for="PublicApiKey" />
            </div>
            <div class="adminData wide">
                <setting-editor asp-for="PublicApiKey"></setting-editor>
                <span asp-validation-for="PublicApiKey"></span>
            </div>
        </div>
        <div class="adminRow">
            <div class="adminTitle">
                <smart-label asp-for="SecrectApiKey" />
            </div>
            <div class="adminData wide">
                <setting-editor asp-for="SecrectApiKey"></setting-editor>
                <span asp-validation-for="SecrectApiKey"></span>
            </div>
        </div>
        <div class="adminRow">
            <div class="adminTitle">
                <smart-label asp-for="WebhookSecret" />
            </div>
            <div class="adminData wide">
                <setting-editor asp-for="WebhookSecret"></setting-editor>
                <span asp-validation-for="WebhookSecret"></span>
            </div>
        </div>
        <div class="adminRow">
            <div class="adminTitle">
                <smart-label asp-for="WebhookUrl" />
            </div>
            <div class="adminData">
                <div class="input-group">
                    <input asp-for="WebhookUrl" readonly />
                    <div class="input-group-append">
                        <button class="btn btn-light btn-icon btn-clipboard" data-copy-from="#@(Html.IdFor(x => x.WebhookUrl))">
                            <bootstrap-icon name="clipboard" />
                        </button>
                    </div>
                    <span class="input-group-append">
                        <button type="submit" id="createwebhook" name="createwebhook" value="createwebhook" class="btn btn-light"
                                attr-disabled='(!Model.PublicApiKey.HasValue() || !Model.SecrectApiKey.HasValue(), "disabled")'>
                            <i class="fa fa-cog"></i>
                            <span>@T("Plugins.Smartstore.Stripe.CreateWebhook")</span>
                        </button>
                    </span>
                </div>
            </div>
        </div>
        <div class="adminRow">
            <div class="adminTitle">
                <smart-label asp-for="CaptureMethod" />
            </div>
            <div class="adminData">
                <setting-editor asp-for="CaptureMethod">
                    <select asp-for="CaptureMethod" asp-items="ViewBag.AvailableCaptureMethods"></select>
                </setting-editor>
                <span asp-validation-for="CaptureMethod"></span>
            </div>
        </div>
        <div class="adminRow">
            <div class="adminTitle">
                <smart-label asp-for="AdditionalFee" />
            </div>
            <div class="adminData">
                <setting-editor asp-for="AdditionalFee" sm-postfix="@ViewBag.CurrentCurrencyCode"></setting-editor>
                <span asp-validation-for="AdditionalFee"></span>
            </div>
        </div>
        <div class="adminRow">
            <div class="adminTitle">
                <smart-label asp-for="AdditionalFeePercentage" />
            </div>
            <div class="adminData">
                <setting-editor asp-for="AdditionalFeePercentage"></setting-editor>
                <span asp-validation-for="AdditionalFeePercentage"></span>
            </div>
        </div>
        <div class="adminRow">
            <div class="adminTitle">
                <smart-label asp-for="ShowButtonInMiniShoppingCart" />
            </div>
            <div class="adminData">
                <setting-editor asp-for="ShowButtonInMiniShoppingCart"></setting-editor>
                <span asp-validation-for="ShowButtonInMiniShoppingCart"></span>
            </div>
        </div>
    </div>
</form>